package com.bjgov.scoresys.entity;
// default package

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * ScoreHistory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "score_history", catalog = "scoresys")
public class ScoreHistory implements java.io.Serializable {

	// Fields

	private Integer id;
	private User user;
	private Integer projectItemId;
	private Float decScore;
	private Float standardScore;
	private Integer projectId;
	private Integer topCateId;

	// Constructors

	/** default constructor */
	public ScoreHistory() {
	}

	/** minimal constructor */
	public ScoreHistory(User user, Integer projectItemId, Float decScore) {
		this.user = user;
		this.projectItemId = projectItemId;
		this.decScore = decScore;
	}

	/** full constructor */
	public ScoreHistory(User user, Integer projectItemId, Float decScore,
			Float standardScore, Integer projectId, Integer topCateId) {
		this.user = user;
		this.projectItemId = projectItemId;
		this.decScore = decScore;
		this.standardScore = standardScore;
		this.projectId = projectId;
		this.topCateId = topCateId;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "PROJECT_ITEM_ID", nullable = false)
	public Integer getProjectItemId() {
		return this.projectItemId;
	}

	public void setProjectItemId(Integer projectItemId) {
		this.projectItemId = projectItemId;
	}

	@Column(name = "DEC_SCORE", nullable = false, precision = 12, scale = 0)
	public Float getDecScore() {
		return this.decScore;
	}

	public void setDecScore(Float decScore) {
		this.decScore = decScore;
	}

	@Column(name = "STANDARD_SCORE", precision = 12, scale = 0)
	public Float getStandardScore() {
		return this.standardScore;
	}

	public void setStandardScore(Float standardScore) {
		this.standardScore = standardScore;
	}

	@Column(name = "PROJECT_ID")
	public Integer getProjectId() {
		return this.projectId;
	}

	public void setProjectId(Integer projectId) {
		this.projectId = projectId;
	}

	@Column(name = "TOP_CATE_ID")
	public Integer getTopCateId() {
		return this.topCateId;
	}

	public void setTopCateId(Integer topCateId) {
		this.topCateId = topCateId;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("ScoreHistory [id=");
		builder.append(id);
		builder.append(", user.id=");
		builder.append(user!=null?user.getId():null);
		builder.append(", projectItemId=");
		builder.append(projectItemId);
		builder.append(", decScore=");
		builder.append(decScore);
		builder.append(", standardScore=");
		builder.append(standardScore);
		builder.append(", projectId=");
		builder.append(projectId);
		builder.append(", topCateId=");
		builder.append(topCateId);
		builder.append("]");
		return builder.toString();
	}

}